/****************************************************
          File Name:12-2.h
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Thu 25 Dec 2014 02:58:04 PM CST
*****************************************************/

#ifndef STR_H_
#define STR_H_
#include<iostream>
using std::ostream;
using std::istream;

class String
{
    private:
        char *str;
        static const int CINLIM = 80;
    public:
        String(const char *s);
        String();
        String(const String &);
        ~String();
        //size_t length() const {return size_t(len);}

        String & operator=(const String &st);
        String & operator=(const char *s);
        char & operator[](int i);
        const char & operator[](int i) const;

        friend bool operator<(const String &st1, const String &st2);
        friend bool operator>(const String &st1, const String &st2);
        friend bool operator==(const String &st1, const String &st2);
        friend ostream & operator<<(ostream & os, const String & st);
        friend istream & operator>>(istream & is, String & st);

        // showlower & showupper & overload +
        String  operator+(const char *s); 		// b = a + "this"; -> b = a.operator+("this");
        String  operator+(const String &s); 	// b = a + b; -> b = a.operator+(b);
        friend String  operator+(const char *s,String & st);
        void stringlow();      // lower case
        void stringup();         // upper case
        int has(char ch);
};

#endif
